<template>
    <el-table-column class-name="enmu" :align="align" :label="label" :width="width">
        <template #default="{ row }">
            <template v-if="row[prop] != null">
                <img style="width: 15px; height: 15px; margin: 0 auto;" :src="view(row)" alt="" />
            </template>
            <template v-else></template>
        </template>
    </el-table-column>
</template>

<script setup>
import noImg from "@/assets/images/no.png";
import yesImg from "@/assets/images/yes.png";

const props = defineProps({
    label: {
        type: String,
        default: "停用",
    },
    prop: {
        type: String,
        default: "stopFlag",
    },
    width: {
        type: String,
        default: "60",
    },
    align: {
        type: String,
        default: "center",
    },
});

const view = (row) => {
    if (row) {
        switch (row[props.prop]) {
            case false:
                return noImg;
            case true:
                return yesImg;
        }
    }
    return "";
};
</script>